<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>SB Admin 2 - Bootstrap Admin Theme</title>

    <!-- Bootstrap Core CSS -->
    <link href="/static/sbadmin/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="/static/sbadmin/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="/static/sbadmin/dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Morris Charts CSS -->
    <link href="/static/sbadmin/vendor/morrisjs/morris.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="/static/sbadmin/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    {% block styles %}<!--custom styles-->{% endblock %}

</head>

<body>

    <div id="wrapper">

        <!-- Navigation -->
        <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="index.html">运维管理后台 v2.0</a>
            </div>
            <!-- /.navbar-header -->

            <ul class="nav navbar-top-links navbar-right">
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-envelope fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-messages">
                        <li>
                            <a href="#">
                                <div>
                                    <strong>John Smith</strong>
                                    <span class="pull-right text-muted">
                                        <em>Yesterday</em>
                                    </span>
                                </div>
                                <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <strong>John Smith</strong>
                                    <span class="pull-right text-muted">
                                        <em>Yesterday</em>
                                    </span>
                                </div>
                                <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <strong>John Smith</strong>
                                    <span class="pull-right text-muted">
                                        <em>Yesterday</em>
                                    </span>
                                </div>
                                <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a class="text-center" href="#">
                                <strong>Read All Messages</strong>
                                <i class="fa fa-angle-right"></i>
                            </a>
                        </li>
                    </ul>
                    <!-- /.dropdown-messages -->
                </li>
                <!-- /.dropdown -->
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-tasks fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-tasks">
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>Task 1</strong>
                                        <span class="pull-right text-muted">40% Complete</span>
                                    </p>
                                    <div class="progress progress-striped active">
                                        <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: 40%">
                                            <span class="sr-only">40% Complete (success)</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>Task 2</strong>
                                        <span class="pull-right text-muted">20% Complete</span>
                                    </p>
                                    <div class="progress progress-striped active">
                                        <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 20%">
                                            <span class="sr-only">20% Complete</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>Task 3</strong>
                                        <span class="pull-right text-muted">60% Complete</span>
                                    </p>
                                    <div class="progress progress-striped active">
                                        <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%">
                                            <span class="sr-only">60% Complete (warning)</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>Task 4</strong>
                                        <span class="pull-right text-muted">80% Complete</span>
                                    </p>
                                    <div class="progress progress-striped active">
                                        <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 80%">
                                            <span class="sr-only">80% Complete (danger)</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a class="text-center" href="#">
                                <strong>See All Tasks</strong>
                                <i class="fa fa-angle-right"></i>
                            </a>
                        </li>
                    </ul>
                    <!-- /.dropdown-tasks -->
                </li>
                <!-- /.dropdown -->
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-bell fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-alerts">
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-comment fa-fw"></i> New Comment
                                    <span class="pull-right text-muted small">4 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-twitter fa-fw"></i> 3 New Followers
                                    <span class="pull-right text-muted small">12 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-envelope fa-fw"></i> Message Sent
                                    <span class="pull-right text-muted small">4 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-tasks fa-fw"></i> New Task
                                    <span class="pull-right text-muted small">4 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-upload fa-fw"></i> Server Rebooted
                                    <span class="pull-right text-muted small">4 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a class="text-center" href="#">
                                <strong>See All Alerts</strong>
                                <i class="fa fa-angle-right"></i>
                            </a>
                        </li>
                    </ul>
                    <!-- /.dropdown-alerts -->
                </li>
                <!-- /.dropdown -->
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-user">
                        <li><a href="#"><i class="fa fa-user fa-fw"></i> User Profile</a>
                        </li>
                        <li><a href="#"><i class="fa fa-gear fa-fw"></i> Settings</a>
                        </li>
                        <li class="divider"></li>
                        <li><a href="login.html"><i class="fa fa-sign-out fa-fw"></i> Logout</a>
                        </li>
                    </ul>
                    <!-- /.dropdown-user -->
                </li>
                <!-- /.dropdown -->
            </ul>
            <!-- /.navbar-top-links -->
            {% block leftbar %}{% endblock %}
            <div class="navbar-default sidebar" role="navigation">
                <div class="sidebar-nav navbar-collapse" id="leftbar">
{#                    <ul class="nav" id="side-menu">#}
{#                        <li class="sidebar-search">#}
{#                            <div class="input-group custom-search-form">#}
{#                                <input type="text" class="form-control" placeholder="Search...">#}
{#                                <span class="input-group-btn">#}
{#                                <button class="btn btn-default" type="button">#}
{#                                    <i class="fa fa-search"></i>#}
{#                                </button>#}
{#                            </span>#}
{#                            </div>#}
{#                            <!-- /input-group -->#}
{#                        </li>#}
{##}
{#                        <li>#}
{#                            <a href="{% url "index" %}"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>#}
{#                        </li>#}
{#                        #}
{#                    </ul>#}
                </div>
                <!-- /.sidebar-collapse -->
            </div>
            <!-- /.navbar-static-side -->
        </nav>

        <div id="page-wrapper">
            {% block  content  %} {% endblock %}
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">Dashboard</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->


        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="/static/sbadmin/vendor/jquery/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="/static/sbadmin/vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="/static/sbadmin/vendor/metisMenu/metisMenu.min.js"></script>

    <!-- Morris Charts JavaScript -->
    <script src="/static/sbadmin/vendor/raphael/raphael.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="/static/sbadmin/dist/js/sb-admin-2.js"></script>
    <script type="text/javascript">


{#    window.setInterval(refresh, 1000);#}
{#    function refresh() {#}
{#        var r = new Date().getTime() + Math.random() + Math.random();#}
{#        $("a").each(function () {#}
{#            var v = $(this).attr("href");#}
{#            if (v != undefined) {#}
{#                if (v.indexOf("?")>0) {#}
{#                    if (v.indexOf("r=")>0) {#}
{#                        var idxr = v.indexOf("r=");#}
{#                        v = v.substring(0,idxr-1);#}
{#                        if(v.indexOf("?")<=0){#}
{#                            v = v +"?";#}
{#                        }#}
{#                        $(this).attr("href", v + "&r=" + r);#}
{#                    } else {#}
{#                        $(this).attr("href", v + "&r=" + r);#}
{#                    }#}
{##}
{#                } else {#}
{#                    $(this).attr("href", v + "?r=" + r);#}
{#                }#}
{#            }#}
{##}
{#        });#}
{#    }#}

    //自动生成菜单相关函数
   $(document).ready(function () {
       var url="{% url "user_menu" %}";
        $.ajax(
                {
                    type: "POST",
                    url:url,
                    data: {csrfmiddlewaretoken:"{{csrf_token}}"},
                    dataType: "json",
                     success: function(ret){
                        html='<ul class=nav id=side-menu> <li class=sidebar-search> <div class=input-group custom-search-form> <input type=text class=form-control placeholder=Search...> <span class=input-group-btn> <button class=btn btn-default type=button> <i class=fa fa-search></i> </button> </span> </div> <!-- /input-group --> </li> <li> <a href=index.html><i class=fa fa-dashboard fa-fw></i> Dashboard</a> </li> <li> <a href=#><i class=fa fa-bar-chart-o fa-fw></i> Charts<span class=fa arrow></span></a> <ul class=nav nav-second-level> <li> <a href=flot.html>Flot Charts</a> </li> <li> <a href=morris.html>Morris.js Charts</a> </li> </ul> <!-- /.nav-second-level --> </li> <li> <a href=tables.html><i class=fa fa-table fa-fw></i> Tables</a> </li> <li> <a href=forms.html><i class=fa fa-edit fa-fw></i> Forms</a> </li> <li> <a href=#><i class=fa fa-wrench fa-fw></i> UI Elements<span class=fa arrow></span></a> <ul class=nav nav-second-level> <li> <a href=panels-wells.html>Panels and Wells</a> </li> <li> <a href=buttons.html>Buttons</a> </li> <li> <a href=notifications.html>Notifications</a> </li> <li> <a href=typography.html>Typography</a> </li> <li> <a href=icons.html> Icons</a> </li> <li> <a href=grid.html>Grid</a> </li> </ul> <!-- /.nav-second-level --> </li> <li> <a href=#><i class=fa fa-sitemap fa-fw></i> Multi-Level Dropdown<span class=fa arrow></span></a> <ul class=nav nav-second-level> <li> <a href=#>Second Level Item</a> </li> <li> <a href=#>Second Level Item</a> </li> <li> <a href=#>Third Level <span class=fa arrow></span></a> <ul class=nav nav-third-level> <li> <a href=#>Third Level Item</a> </li> <li> <a href=#>Third Level Item</a> </li> <li> <a href=#>Third Level Item</a> </li> <li> <a href=#>Third Level Item</a> </li> </ul> <!-- /.nav-third-level --> </li> </ul> <!-- /.nav-second-level --> </li> <li> <a href=#><i class=fa fa-files-o fa-fw></i> Sample Pages<span class=fa arrow></span></a> <ul class=nav nav-second-level> <li> <a href=blank.html>Blank Page</a> </li> <li> <a href=login.html>Login Page</a> </li> </ul>';
{#                         html='<ul class="nav" id="side-menu"> <li class="sidebar-search"> <div class="input-group custom-search-form"> <input type="text" class="form-control" placeholder="Search..."> <span class="input-group-btn"> <button class="btn btn-default" type="button"> <i class="fa fa-search"></i> </button> </span> </div><!-- /input-group --> </li> <li> <a href="{% url "index" %}"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a> </li>';#}
{#                         html+='<li> <a href="#"><i class="fa fa-bar-chart-o fa-fw"></i> Charts<span class="fa arrow"></span></a> <ul class="nav nav-second-level"> <li> <a href="flot.html">Flot Charts</a> </li><li> <a href="morris.html">Morris.js Charts</a> </li></ul><!-- /.nav-second-level --> </li>';#}
{##}
{#                         for(var i=0,l=ret.length;i<l;i++){#}
{#                                html+='<li><a href="#"><i class="fa fa-bar-chart-o fa-fw"></i>'+ret[i]['name']+'<span class="fa arrow"></span></a><ul class="nav nav-second-level">';#}
{##}
{#                                html+='<li class=""><a href="#" class="dropdown-toggle"><i class="menu-icon fa fa-desktop"></i><span class="menu-text">'+ret[i]['name']+'</span><b class="arrow fa fa-angle-down"></b> </a> <b class="arrow"></b><ul class="submenu">'#}
{#                             var urllist=ret[i]['list'];#}
{#                             for (var j=0,q=urllist.length;j<q;j++){#}
{#                                   html+='<li><a href="/'+urllist[j]['url_name']+'">'+urllist[j]['name']+'</a></li>';#}
{#                                   // html+='<li class=""><a href="/'+urllist[j]['url_name']+'"><i class="menu-icon fa fa-caret-right"></i>'+urllist[j]['name']+'</a> <b class="arrow"></b> </li>'#}
{#                                }#}
{#                                html+=' </ul></li>'#}
{##}
{#                            }#}
{#                         html+='</ul>';#}

                         console.log(html);
                        $("#leftbar").html(html)
                     },
                     error: function (msg) {
                          alert("Connect Error");
                    }
                }
                  )
   });



    function getCookie(name){
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");

    if(arr=document.cookie.match(reg))

        return unescape(arr[2]);
    else
        return null;
}

function setCookie(name,value)
{
    var Days = 30;
    var exp = new Date();
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}

function delCookie(name)
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
    if(cval!=null)
        document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}




function ajax_get(url,sid,isresult,tdlocation,postdata){
    $.ajax({
            type: "POST",
            url:url,
           data: postdata,
            dataType: "json",
           beforeSend:function(XMLHttpRequest){
               $("#mytable").find("tr").each(function() {
                    var tdArr = $(this).children();
                    selectid=tdArr.eq(1).html(); //判断ID是否相同,相同则自动修改 td result的显示
                    if(sid==selectid){
                        tdArr.eq(tdlocation).html("");} //请求之前清空td array 数值
                    });
          $("#loading").html("<img src='/static/images/loading-1.gif' />"); //在后台返回success之前显示loading图标

     	},
            timeout:300000,
            success: function(ret){
                $("#loading").empty(); //ajax返回成功，清除loading图标
                if(isresult==0){         //判断是否添加到表格
                    $("#mytable").find("tr").each(function() {
                    var tdArr = $(this).children();
                    selectid=tdArr.eq(1).html(); //判断ID是否相同,相同则自动修改 td result的显示

                    if(sid==selectid){
                        tdArr.eq(tdlocation).html(ret.msg);}
                    });

                }else {
                    alert(ret.msg);
                }
            },
                error: function (msg) {
                    $("#mytable").find("tr").each(function() {
                    var tdArr = $(this).children();
                    selectid=tdArr.eq(1).html(); //判断ID是否相同,相同则自动修改 td result的显示
                    if(sid==selectid){
                        tdArr.eq(tdlocation).html('<p style="color:red;font-size:9px ">请求失败</p>');}
                    });
                     }
    });
}
 </script>
    {% block scripts %}
<!--custom scripts-->
{% endblock %}
</body>

</html>
